//
//  SecondView.swift
//  SwiftUIExample
//
//  Created by qingzhou on 2021/6/21.
//
import CoreLocationUI
import SwiftUI

@available(iOS 15.0, *)
struct SecondView: View {
    @State private var showingAlert = false
    @State private var showingAlert2 = false
    @State private var showingDialog = false
    var body: some View {
        NavigationView {
            ZStack {
                LinearGradient(gradient: Gradient(colors: [.cyan,.green]), startPoint: .topLeading, endPoint: .bottomTrailing)
                VStack {
                    Button("我是弹窗"){
                        showingAlert = true
                    }
                    .alert("通知",isPresented: $showingAlert) {
                        //                Button("第一层", role: .destructive) {}
                        Button("确定",role: .destructive) {}
                        
                        Button("取消",role: .cancel) {}
                        
                    }
                    Button("**我也是弹窗**"){//加粗
                        showingAlert2 = true
                    }
                    .alert("通知",isPresented: $showingAlert2) {
                        Button("第一层", role: .destructive) {}
                        Button("第二层") {}
                        Button("取消",role: .cancel) {}
                    }
                    Button("我是下方抽屉") {
                        showingDialog = true
                    }
                    .confirmationDialog("请选择吧", isPresented: $showingDialog) {
                        Button("相机") {}
                        Button("相册") {}
                        Button("取消", role: .cancel) {}
                    }
                    
                    Menu("菜单"){
                        Button("Duplicate", action: duplicate)
                        Button("Rename", action: rename)
                        Button("Delete…", action: delete)
                        Menu("Copy") {
                            Button("Copy", action: copy)
                            Button("Copy Formatted", action: copyFormatted)
                            Button("Copy Library Path", action: copyPath)
                        }
                    }
                    
                    Text("This is regular text")
                    Text("This is *regular* text")//倾斜
                    Text("This is ***regular*** text")//倾斜加粗
                    Text("~~This is regular text~~")//删除线
                    Text("`This is` regular text")
    //                Text("This is regular text:[click here](www.baidu.com)")
                    
                    HStack {
                        Image(systemName: "clock")
                        Text("我是渐变色")
                    }
                    .font(.largeTitle.bold())
                    .foregroundStyle(
                        .linearGradient(colors: [.red, .black], startPoint: .top, endPoint: .bottom)
                    )
                }
                .foregroundStyle(
                    .linearGradient(colors: [.black, .red], startPoint: .top, endPoint: .bottom)
                )
            }
            .navigationTitle(
                Text("我是标题")
            )
            .navigationBarTitleDisplayMode(.inline)
        }
        
    }
    func duplicate(){}
    func rename(){}
    func delete(){}
    func copy(){}
    func copyFormatted(){}
    func copyPath(){}
}

@available(iOS 15.0, *)
struct SecondView_Previews: PreviewProvider {
    static var previews: some View {
        SecondView()
    }
}
